﻿using System;
using System.Collections.Generic;
using System.Text;
using System.Collections.Specialized;

namespace CanSWAT.ArcSWAT
{
    /// <summary>
    /// From FullHRU and SplitHrus. Used to process hru split information
    /// </summary>
    class Landuse
    {
        public Landuse(string code)
        {
            _code = code;
            _percentage = 100;
        }

        public Landuse(string code, double percentage)
        {
            _code = code;
            _percentage = percentage;
        }

        public string Code
        {
            get { return _code; }
        }

        public double Percentage
        {
            get { return _percentage; }
        }

        private string _code;
        private double _percentage;

        private List<Landuse> _subLanduses = null;

        public void AddSubLanduse(string code, double percentage)
        {
            if (_subLanduses == null)
                _subLanduses = new List<Landuse>();

            //if (_subLanduses.Contains(code)) return;

            _subLanduses.Add(new Landuse(code, percentage));
        }

        public List<HRU> GenerateSubHRUs(HRU parentHRU,StringCollection modeledHRUs)
        {
            List<HRU> subHRUs = new List<HRU>();
            foreach (Landuse lu in _subLanduses)
                subHRUs.Add(new HRU(lu, parentHRU, modeledHRUs));
            return subHRUs;
        }
    }
}
